﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NewsClassifierFreshnessMeasurement.Model;

namespace AutoExtractQueryToXMLFile
{
    public class ProduceAllFile
    {
        List<News> listNews;
        List<SmallExperiment> listSmallExperiment;
        List<SmallExperimentQueries> listSmallExpeQueries;
        string outputXMLFileName;
        string connString;
        public ProduceAllFile(string _connString,string _queryString,string _outputXMLName,List<string> newsID)
        {
            listNews = ProduceFile.GetNewsFromDatabase(_connString,_queryString,newsID);
            listSmallExperiment = new List<SmallExperiment>();
            listSmallExpeQueries = new List<SmallExperimentQueries>();
            outputXMLFileName = _outputXMLName;
            connString = _connString;
        }
        public void CreateFile(List<InputPackage> listInputPkg)
        {
            foreach (InputPackage pkg in listInputPkg)
            {
                ProduceFile pro = new ProduceFile(listNews, listSmallExperiment, listSmallExpeQueries);
                pro.Start(listNews, pkg,connString);
            }
            ProduceFile.CreateFile(outputXMLFileName,listNews,listSmallExperiment,listSmallExpeQueries);
        }
    }
}
